/*
 * Copyright (C) 2013 by KB3ZYT Richard Nash
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef _BALLOONSTATEMACHINE_H
#define _BALLOONSTATEMACHINE_H

#define STATE_INIT "INIT"
#define STATE_AWAITING_LAUNCH "WAIT"
#define STATE_LAUNCHED "LAUNCH"
#define STATE_DESCENT "DESCENT"
#define STATE_LANDED "LANDED"
#define STATE_WAITING "WAITING"
#define GOOD_FIX_COUNT_TO_READY_STATE 1
//#define INCLUDE_BMP


#include "GPS.h"

class BalloonStateMachine {
public:
    BalloonStateMachine();
    void pumpState(GPS &gps);
    
    char *state;
    
private: // Data
    char logFileName[11];
    unsigned long lastTransitionTime;
    unsigned long lastTransmitionTime;
    float startingAltitude;
    float highestAltitude;
    int tmpCounter;
    
    
private: // Methods
    void initializeLogger(GPS &);
    void initializeRadio();
    void logLocation(GPS &,float,float,float,float);
    void broadcastLocation(GPS &,float,float,float,float);
};

#endif
